var Feedback = function(){

	return {

		    init: function () {
            
	            if (!jQuery().dataTable) {
	                return;
	            }

	            $("#player_feedback_table").dataTable();

	            $("#reply-modal").on("hidden.bs.modal", function() {
				    $(this).removeData("bs.modal");
				    document.location.reload();
				});

	            $("#replyBtn").on('click',function(){
	
	            	var content = $("#replyContent").val();
	            	if(content) {
	            		$.ajax({
	            			url: 'player/feedback_reply',
	            			type: 'POST',
	            			dataType: 'json',
	            			data: {content: 'content'},
	            		})
	            		.done(function(data) {
	            			if(data.code==0) {
	            				var msg = '<li class="out"><img class="avatar img-responsive" alt="" src="assets/img/avatar2.jpg" > \
	            								<div class="message"><span class="arrow"></span> \
												<a href="#" class="name">'+客服小张+'/a> \
												<span class="datetime">'+Date.parse(new Date())/1000+'</span> \
												<span class="body">'+content+'</span></div></li>';
								$("#feedbackViewList").append(msg);
	            			} else {

	            			}
	            			alert(data.msg);
	            			console.log("success");
	            		})
	            		.fail(function() {
	            			console.log("error");
	            		})
	            		.always(function() {
	            			console.log("complete");
	            		});
	            		
	            	} else {
	            		alert("回复内容不能为空");
	            	}
	            });
	     	}
   		};

}();